package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("/report")
@RestController
@Slf4j
public class ReportController {
    @Autowired
    private ReportService reportService;
    /**
     * 统计员工职位人数
     *
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        log.info("统计员工职位人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData") // 统计员工性别比例
    public Result getEmpGenderData(){
        log.info("统计员工性别比例");
        List<Map<String, Object>> genderlist = reportService.getEmpGenderData();
         return Result.success(genderlist);
    }
    @GetMapping("/studentDegreeData") // 统计学生学历比例
    public Result getStudentDegreeData(){
        log.info("统计学生学历比例");
        List<Map<String, Object>> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }
}
